<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class InstallInfo extends Model
{
    public $fillable = [
    	'device_code',
    	'customer_name',
    	'phone',
    	'installation_address',
    	'operator',
    	'operator_phone',
    	'status',
        'dealer',
        'install_at',
        'remark',
    ];

    protected $dates = ['install_at'];

    public function getStatusAttribute($value)
    {
        $statusDescription = [
            '未安装',
            '已安装',
        ];
        return $statusDescription[$value];
    }

    public function setStatusAttribute($value)
    {
        $statusArray = [
            '未安装' => 0,
            '已安装' => 1,
        ];
        $this->attributes['status'] = $statusArray[$value];
    }
}
